package com.imelite.qyh.repository;


import com.imelite.qyh.base.ApplicationContextHelper;
import com.imelite.qyh.model.Jxcpcs;
import com.imelite.qyh.service.JxcpcsService;
import com.imelite.qyh.util.BaseStringUtil;

import java.util.ArrayList;
import java.util.List;

public class JxcpcsRepository {
    private static JxcpcsService jxcpcsService= (JxcpcsService) ApplicationContextHelper.getBean("jxcpcsService");

    private static JxcpcsRepository instance = null;
    public static synchronized JxcpcsRepository getInstance() {
        if (instance == null) {
            instance = new JxcpcsRepository();
        }
        return instance;
    }

    public static List<Jxcpcs> selectByGroup(String id){
        List<Jxcpcs> jxcpcsList=jxcpcsService.selectAll();
        List<Jxcpcs> temp=new ArrayList<>();
        for(Jxcpcs j:jxcpcsList){
            if(BaseStringUtil.isNotBlank(j.getFz()) && j.getFz().equals(id)){
                temp.add(j);
            }
        }
        return temp;
    }
}
